package com.xfcy.blog.dto;

import com.xfcy.blog.valid.AddGroup;
import com.xfcy.blog.valid.SimpleValue;
import com.xfcy.blog.valid.UpdateGroup;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Null;

/**
 * 邮箱登录DTO类
 *
 * @author 晓风残月Lx
 * @date 2023/4/20 20:14
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class EmailLoginDTO {

    @NotBlank(message = "邮箱不能为空", groups = {AddGroup.class})
    @Email(message = "邮箱必须是一个合法的邮箱地址" ,groups = {AddGroup.class})
    private String email;

    @Length(min = 6, message = "密码不能小于6位", groups = {AddGroup.class})
    @NotBlank(message = "密码不能为空", groups = {AddGroup.class})
    private String password;

    @SimpleValue(value = 6, message = "验证码不为6位", groups = {UpdateGroup.class})
    @NotBlank(message = "验证码不能为空", groups = {UpdateGroup.class})
    @Null(message = "多余参数", groups = AddGroup.class)
    private String code;

}
